cmake_minimum_required(VERSION 3.10.2)
project(adapter)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -fno-rtti -fvisibility=default -D_GNU_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -fPIC -fpic -ffunction-sections -D_GLIBC_MOCK")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-as-needed -ldl")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=0 -fpermissive")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-generate -ftest-coverage")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-generate -ftest-coverage")
set(MOCK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../mock")
set(KV_STORE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../kv_store")
add_definitions(-DCONFIG_PUBLIC_VERSION)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/ adapterSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/account/src adapterSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/auth/src adapterSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/autils/src adapterSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/autils/src/thread_pool adapterSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/broadcaster/src adapterSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/communicator/src adapterSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/permission/src adapterSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/dfx/src adapterSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/dfx/src/fault adapterSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/dfx/src/statistic adapterSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/dfx/src/security adapterSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/dfx/src/behaviour adapterSrc)
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/utils/src adapterSrc)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../frameworks/common)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../framework/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/account)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/auth)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/autils)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/broadcaster)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/communicator)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/dfx)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/log)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/permission)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/utils)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/dfx/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../../utils_native/base/include)
include(${MOCK_DIR}/include/CMakeLists.txt OPTIONAL)
include(${KV_STORE_DIR}/interfaces/CMakeLists.txt OPTIONAL)
set(links secure mock distributeddb crypto)

add_library(adapter SHARED ${adapterSrc})
target_link_libraries(adapter ${links})
